package com.ymm.system.core.testController;

import com.ymm.system.api.constants.CargoEntity;
import com.ymm.system.api.constants.LltorderEntity;
import com.ymm.system.api.constants.TradeEntity;
import com.ymm.system.api.dto.LltorderDetailsDTO;
import com.ymm.system.dao.mapper.CargoMapper;
import com.ymm.system.dao.mapper.DriverMapper;
import com.ymm.system.dao.mapper.LltorderMapper;
import com.ymm.system.dao.mapper.TradeMapper;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * @auther ZhangHongyuan
 * @date 2022/8/5 13:26
 */
@RestController
@RequestMapping("/system/mapper")
public class MapperTestController {

    @Resource
    private DriverMapper driverMapper;

    @Resource
    private TradeMapper tradeMapper;

    @Resource
    private CargoMapper cargoMapper;

    @Resource
    private LltorderMapper lltorderMapper;

    @RequestMapping("/search")
    public List<Long> testSearch(){
        //  List<OrderShowDTO> orderShowDTOList = systemDisplayService.searchOrderDetailByPage();
        //  return orderShowDTOList.size();
      return lltorderMapper.listDischargedOutTimeOrderId();
      //  return cargoMapper.listOutTimeCargo();
    }

    @RequestMapping("/get")
    public void testget(){
        //  List<OrderShowDTO> orderShowDTOList = systemDisplayService.searchOrderDetailByPage();
        //  return orderShowDTOList.size();
        cargoMapper.updateCargoState(9L,2);
        //  return cargoMapper.listOutTimeCargo();
    }

    @RequestMapping("/inserttrade")
    public void testInsert(){
        //  List<OrderShowDTO> orderShowDTOList = systemDisplayService.searchOrderDetailByPage();
        //     return orderShowDTOList.size();
//        TradeEntity tradeEntity = new TradeEntity();
//        tradeEntity.setTradeId(Long.valueOf(0));
//        tradeEntity.setDriverLocation("nanjing");
//        tradeEntity.setTradeDriverState(0);
//        tradeEntity.setTradeCreateTime(new Date());
//        tradeEntity.setTradeUpdateTime(new Date());
//        tradeMapper.insertNewTrade(tradeEntity);
        lltorderMapper.updateOrderCancelReason(75L, 2, "嘿~就是玩儿~");
        lltorderMapper.updateOrderCancelType(75L, 3);
    }

    @RequestMapping("/insertorder")
    public void testInsert2(){
        //  List<OrderShowDTO> orderShowDTOList = systemDisplayService.searchOrderDetailByPage();
        //     return orderShowDTOList.size();
        LltorderEntity lltorderEntity = new LltorderEntity();
        lltorderEntity.setOrderId(Long.valueOf(0));
        lltorderEntity.setTradeId(Long.valueOf(1));
        lltorderEntity.setDriverId(Long.valueOf(1));
        lltorderEntity.setShipperId(Long.valueOf(1));
        lltorderEntity.setOrderShipperState(0);
        lltorderEntity.setCargoId(Long.valueOf(1));
        lltorderEntity.setOrderCreateDate(new Date());
        lltorderEntity.setOrderUpdateDate(new Date());
        lltorderEntity.setOrderPrice(100);
        lltorderMapper.insertNewOrder(lltorderEntity);
    }
}
